//
//  YXYSelectionPeoTableViewCell.m
//  Topit
//
//  Created by dllo on 15/12/5.
//  Copyright © 2015年 YXY. All rights reserved.
//

#import "YXYSelectionPeoTableViewCell.h"

@implementation YXYSelectionPeoTableViewCell

- (void)dealloc {
    [_idImage release];
    [_idName release];
    [_ts release];
    [_fnum release];
    [_heart release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.idImage = [[UIImageView alloc] initWithFrame:CGRectZero];
        _idImage.layer.cornerRadius = 15;
        _idImage.clipsToBounds = YES;
        [self addSubview:_idImage];
        [_idImage release];
        
        self.idName = [[UILabel alloc] initWithFrame:CGRectZero];
        _idName.font = [UIFont systemFontOfSize:10];
        [self addSubview:_idName];
        [_idName release];
        
        self.ts = [[UILabel alloc] initWithFrame:CGRectZero];
        _ts.font = [UIFont systemFontOfSize:8];
        _ts.textColor = [UIColor grayColor];
        [self addSubview:_ts];
        [_ts release];
        
        self.fnum = [[UILabel alloc] initWithFrame:CGRectZero];
        _fnum.textColor = [UIColor orangeColor];
        _fnum.font = [UIFont systemFontOfSize:12];
        [self addSubview:_fnum];
        [_fnum release];
        
        self.heart = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:_heart];
        [_heart release];
    }
    return self;
}

-(void)setSelectionModel:(YXYSelectionModel *)selectionModel {
    if (_selectionModel != selectionModel) {
        [_selectionModel release];
        _selectionModel = [selectionModel retain];
    }
    YXYSelectionLowerModel *seleLowerModle = [selectionModel.btnArray lastObject];
    [_idImage sd_setImageWithURL:seleLowerModle.icon[@"url"]];
    _idName.text = seleLowerModle.cont;
    _ts.text = selectionModel.ts;
    _fnum.text = [NSString stringWithFormat:@"%@", selectionModel.fnum];
    
    _heart.image = [UIImage imageNamed:@"heart"];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _idImage.frame = CGRectMake(5, 5, 30, 30);
    _idName.frame = CGRectMake(_idImage.right + 5, _idImage.top - 2, 100, self.height / 2);
    _ts.frame = CGRectMake(_idName.origin.x, _idName.bottom + 2, 100, self.height / 2);
    _fnum.frame = CGRectMake(self.size.width - 70, self.height / 2, 40, self.height / 2);
    _heart.frame = CGRectMake(_fnum.right, _idImage.origin.y + 10, _idImage.width - 5, self.height - 20);
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
